package com.vae.config;


import com.vae.porperty.MinioClientProperties;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * Minio 配置类
 */
@Configuration
@EnableConfigurationProperties(MinioClientProperties.class)
public class MinioConfig {
    @Autowired
    private MinioClientProperties minioClientProperties;
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioClientProperties.getEndpoint())
                .credentials(minioClientProperties.getAccessKey(),
                        minioClientProperties.getSecretKey())
                .build();
    }
}